const express = require('express');
const router = new express.Router();

/**
 * @param {Object} options
 * @param {} options.code 编号
 * @param {} options.partSaleOrderHisCode 订单编号
 * @param {} options.partCode 备件编号
 * @param {} options.preparationCode 备料单号
 * @param {} options.partStatus 价格条款  1-备货中  2-已发货  3-发货过账  4-已收货
 * @param {} options.pageSize 每页数据量
 * @param {} options.pageIndex 指定页
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/', async(req, res, next) => {
    const options = {
        code: req.query.code,
        partSaleOrderHisCode: req.query.partSaleOrderHisCode,
        partCode: req.query.partCode,
        preparationCode: req.query.preparationCode,
        partStatus: req.query.partStatus,
        pageSize: req.query.pageSize,
        pageIndex: req.query.pageIndex,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id91',
                    code: 'code92',
                    partSaleOrderHisCode: 'partSaleOrderHisCode93',
                    partCode: 'partCode94',
                    partName: 'partName95',
                    partEngName: 'partEngName96',
                    allocationQuantity: 1,
                    receiptQuantity: 1,
                    preparationCode: 'preparationCode97',
                    partStatus: 1,
                    rreplacedPartCode: 'rreplacedPartCode98',
                    remark: 'remark'
                },
                {
                    id: 'id99',
                    code: 'code100',
                    partSaleOrderHisCode: 'partSaleOrderHisCode101',
                    partCode: 'partCode102',
                    partName: 'partName103',
                    partEngName: 'partEngName104',
                    allocationQuantity: 1,
                    receiptQuantity: 1,
                    preparationCode: 'preparationCode105',
                    partStatus: 1,
                    rreplacedPartCode: 'rreplacedPartCode106',
                    remark: 'remark'
                }
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});
module.exports = router;
